Skip to content

[cmake] move ExternalProject_Add to subdir for consistency, and define proper GSL,FFTW,TBB targets#21904

Open
ferdymercury wants to merge 8 commits intoroot-project:masterfrom
ferdymercury:builtinsub
Open

[cmake] move ExternalProject_Add to subdir for consistency, and define proper GSL,FFTW,TBB targets#21904
ferdymercury wants to merge 8 commits intoroot-project:masterfrom
ferdymercury:builtinsub

Conversation

@ferdymercury
Copy link
Copy Markdown
Collaborator

Try unbloating the huge SearchInstalledSoftware
and use always subdirs for ExternalProject_Add for symmetry with other builtins

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

Test Results

    22 files      22 suites   3d 4h 49m 28s ⏱️
 3 833 tests  3 831 ✅  1 💤 1 ❌
75 650 runs  75 631 ✅ 18 💤 1 ❌

For more details on these failures, see this check.

Results for commit 78db3b5.

♻️ This comment has been updated with latest results.

Comment thread math/mathmore/CMakeLists.txt Outdated
Comment thread roofit/roofitmore/CMakeLists.txt Outdated
Comment thread math/mathmore/test/CMakeLists.txt Outdated
@ferdymercury ferdymercury changed the title [cmake] move ExternalProject_Add to subdir for consistency [cmake] move ExternalProject_Add to subdir for consistency, and define proper GSL target Apr 13, 2026
@ferdymercury ferdymercury changed the title [cmake] move ExternalProject_Add to subdir for consistency, and define proper GSL target [cmake] move ExternalProject_Add to subdir for consistency, and define proper GSL,FFTW targets Apr 13, 2026
Comment thread math/mathmore/test/CMakeLists.txt Outdated
Comment thread math/mathmore/CMakeLists.txt Outdated
Comment thread roofit/roofitmore/CMakeLists.txt Outdated
@ferdymercury ferdymercury changed the title [cmake] move ExternalProject_Add to subdir for consistency, and define proper GSL,FFTW targets [cmake] move ExternalProject_Add to subdir for consistency, and define proper GSL,FFTW,TBB targets Apr 14, 2026
Comment thread core/thread/CMakeLists.txt Outdated
@ferdymercury ferdymercury marked this pull request as ready for review April 14, 2026 10:08
@ferdymercury
Copy link
Copy Markdown
Collaborator Author

@bellenot could you let me know what is the contents (filenames) inside:

C:/libs/x64/fftw/3.3.5/lib on the Windows runners?

Or alternatively, what targets are defined once you run find_package with the new FindFFTW.cmake script in this branch ?

Comment thread cmake/modules/FindFFTW.cmake Outdated
@bellenot
Copy link
Copy Markdown
Member

@ferdymercury here is the content of C:\libs\x64\fftw\3.3.5\lib:

 Directory of C:\libs\x64\fftw\3.3.5\lib

10/11/2025  13:17    <DIR>          .
10/11/2025  13:17    <DIR>          ..
04/03/2022  11:47           238,966 fftw3-3.lib
03/03/2022  09:13           241,990 libfftw3-3.lib
03/03/2022  09:13           247,600 libfftw3f-3.lib
03/03/2022  09:13           149,230 libfftw3l-3.lib
               4 File(s)        877,786 bytes
               2 Dir(s)  73,924,689,920 bytes free

And I'll try your branch...

@bellenot
Copy link
Copy Markdown
Member

@ferdymercury BTW, what is the problem with FFTW?

@bellenot
Copy link
Copy Markdown
Member

And here is what CMake finds:
image

@bellenot
Copy link
Copy Markdown
Member

bellenot commented Apr 14, 2026

Here are (some of) the errors on Windows:

[...]
    Exit code 0xc0000135
    Exit code 0xc0000135
    Exit code 0xc0000135
  C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Microsoft\VC\v180\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'C:\ROOT-CI\build\CMakeFiles\d062ca236c6013e32d1af865d69dc514\G__RooFitJSONInterface.cxx.rule;C:\ROOT-CI\src\roofit\jsoninterface\CMakeLists.txt' exited with code 1. [C:\ROOT-CI\build\roofit\jsoninterface\G__RooFitJSONInterface.vcxproj]
    Generating G__ROOTGpadv7.cxx, ../../bin/libROOTGpadv7_rdict.pcm, ../../bin/libROOTGpadv7.rootmap
  C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Microsoft\VC\v180\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'C:\ROOT-CI\build\CMakeFiles\9c31611484f5c242b181395c24233222\DataFrameSnapshotUtils.cxx.rule;C:\ROOT-CI\src\tree\dataframe\test\CMakeLists.txt' exited with code 1. [C:\ROOT-CI\build\tree\dataframe\test\DataFrameSnapshotUtils.vcxproj]
    Generating RXTupleDict.cxx, libntuple_compat_rdict.pcm, libntuple_compat.rootmap
  C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Microsoft\VC\v180\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'C:\ROOT-CI\build\CMakeFiles\4216675670bde90fccb32452aa24052b\G__XMLParser.cxx.rule;C:\ROOT-CI\src\io\xmlparser\CMakeLists.txt' exited with code 1. [C:\ROOT-CI\build\io\xmlparser\G__XMLParser.vcxproj]
    Exit code 0xc0000135
    Exit code 0xc0000135
[...]

Hard to tell where they are coming from (i.e, which DLL is not found). I'll have to debug it locally

@ferdymercury
Copy link
Copy Markdown
Collaborator Author

ferdymercury commented Apr 14, 2026

what is the problem with FFTW?

The current FindFFTW.cmake did not define a proper target so I borrowed a more up-to-date one by @egpbos but it seems it had a bug for Win32. I just fixed it so that it now finds all variants of FFTW3 correctly on Windows.

@bellenot
Copy link
Copy Markdown
Member

@ferdymercury FYI the issue is coming from TBB. I'm looking into it

@ferdymercury ferdymercury added the clean build Ask CI to do non-incremental build on PR label Apr 15, 2026
@ferdymercury ferdymercury force-pushed the builtinsub branch 2 times, most recently from 19375c8 to 63ee525 Compare April 15, 2026 07:23
@ferdymercury ferdymercury removed the clean build Ask CI to do non-incremental build on PR label Apr 15, 2026
@ferdymercury ferdymercury force-pushed the builtinsub branch 3 times, most recently from 113a3d3 to 070cca6 Compare April 15, 2026 07:53
Comment thread builtins/tbb/CMakeLists.txt
Copy link
Copy Markdown
Member

@hageboeck hageboeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good opportunity to make the builtins conform to what find modules would output. This means that we need to set the following variables (from here):

Xxx_INCLUDE_DIRS
Xxx_LIBRARIES

We also need to remember that:

  • They must not be CACHE variables
  • And they need to be set in the PARENT_SCOPE now that they are in subdirectories

I see that for some deps, this is done, for others it's not, so we have a chance now to unify this.

Comment thread builtins/fftw3/CMakeLists.txt Outdated
Comment thread builtins/fftw3/CMakeLists.txt Outdated
Comment thread builtins/fftw3/CMakeLists.txt Outdated
@ferdymercury
Copy link
Copy Markdown
Collaborator Author

This is a good opportunity to make the builtins conform to what find modules would output. This means that we need to set the following variables (from here):

Xxx_INCLUDE_DIRS
Xxx_LIBRARIES

We also need to remember that:

* They must not be CACHE variables

* And they need to be set in the `PARENT_SCOPE` now that they are in subdirectories

I see that for some deps, this is done, for others it's not, so we have a chance now to unify this.

Thanks, good idea. I have fixed most now.

Additional fixes are in the corresponding PRs:
#21898
#21806
#21857
#21916

In any case, if/when all these are in, I was planning to do an additional uniformization formatting PR, meaning all builtins should start with the same lines:

# **PLEASE UPDATE ALSO THE FOLLOWING LINE WHEN UPDATING THE VERSION**
# 19 Feb 2024, https://whatever

and have all ROOT_PACKAGE_VERSION rather than packageVersion and things like that.

@ferdymercury ferdymercury force-pushed the builtinsub branch 2 times, most recently from cea8b88 to 4329664 Compare April 15, 2026 17:06
Copy link
Copy Markdown
Member

@hageboeck hageboeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates! I found a few more things to look at. Do we know the licence of the file that you copied?

-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${GTEST_CXX_FLAGS}
-DCMAKE_AR=${CMAKE_AR}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken, this would try to install gtest in something like /usr/local. Instead of disabling the install command, once could make this:

${CMAKE_BINARY_DIR}/builtins/gtest

Suggested change
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/builtins/googletest

Edit: I see that you only moved that code over. I think we can leave it for a later time to simplify this file a bit.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, just moved. Shall I apply all / none / or a part of the commits you suggested on this file?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also VDT building in binary-dir rather than in builtins/ as the others but did not change that either. Was thinking to do the uniformization later on transversally for all once we get the overview of all.

set_target_properties(${lib} PROPERTIES
IMPORTED_LOCATION "${_G_LIBRARY_PATH}${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
add_dependencies(${lib} googletest)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the "canonical" names that are now used in ROOT:

Suggested change
add_dependencies(${lib} googletest)
add_dependencies(${lib} googletest)
add_library(GTest::${lib} ALIAS ${lib})

Comment on lines +1 to +7
# - Find the FFTW library
# https://github.com/egpbos/findFFTW/
# Original version of this file:
# Copyright (c) 2015, Wenzel Jakob
# https://github.com/wjakob/layerlab/blob/master/cmake/FindFFTW.cmake, commit 4d58bfdc28891b4f9373dfe46239dda5a0b561c6
# Modifications:
# Copyright (c) 2017, Patrick Bos
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dpiparo, OK to take over other people's find files?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think license-technically you should include the license text as well, which could also be done as a header in the FindFFTW.cmake file itself rather than as a separate file. But I won't press charges either way ;)

Comment thread core/thread/CMakeLists.txt Outdated
@ferdymercury
Copy link
Copy Markdown
Collaborator Author

ferdymercury commented Apr 16, 2026

Do we know the licence of the file that you copied?

FFTW: It's BSD-2 originally and later BSD-3

Comment thread cmake/modules/FindFFTW.cmake
Comment thread net/net/CMakeLists.txt Outdated
and misc improvements

Co-authored-by: Stephan Hageboeck <stephan.hageboeck@cern.ch>
Co-authored-by: ferdymercury <ferdymercury@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants